{% extends "ld/layout.jinja2" %}
{% import "ld/lib/passport.jinja2" as pass with context %}
{% import "ld/lib/sparql_main.jinja2" as spql with context %}

{% set agent_likes = graph.queryAsync(
  spql.q_rsc_likes,
  initBindings={'agent': U(pass.dwebPass.me["@id"]), 'rsc': rscUriRef}) | length
%}
{% set likes = graph.queryAsync(spql.q_rsc_likes, initBindings={'rsc': rscUriRef}) %}

{% set headline = graph.value(
  rscUriRef, URIRef('ips://galacteek.ld/headline')) %}

{% set body = graph.value(
  rscUriRef, URIRef('ips://galacteek.ld/articleMarkdownBody')) %}

{% set descr = graph.value(
  rscUriRef, URIRef('ips://galacteek.ld/description')) %}

{% set dateCreated = graph.value(
  rscUriRef, URIRef('ips://galacteek.ld/dateCreated')) %}

{% block body %}

<p align="right">
{{ likes|length }}

{% if agent_likes == 0 %}
<button id="btnlike" onclick="rsc_like('{{ pass.dwebPass.me["@id"] }}', '{{ rscUri }}')">
  <img width="16" src="qrc:/share/icons/social/like.png"/>
</button>
{% else %}
<img width="16" src="qrc:/share/icons/social/like.png"/>
{% endif %}

</button>
</p>

<p align="center">
<h1><b>{{ headline }}</b></h1>
</p>

<p>
{{ body|markdown }}
</p>

{% endblock %}
